<?php

/*

List Items (listitems.php)

*/

$rank_check = 0;
$page_title = "List Items";
include "header.inc.php";

if (!$start) { $start = 0; }
$max = 10;
$max2 = $start + $max;

$findItemList = mysql_query("SELECT * FROM items2 WHERE game = '$game' ORDER BY id DESC LIMIT $start,$max");
$numItems2 = mysql_num_rows($findItemList);
$findItemList2 = mysql_query("SELECT * FROM items2 WHERE game = '$game'");
$numItems = mysql_num_rows($findItemList2);
while ($getItemList = mysql_fetch_array($findItemList))
{
	if ($getItemList[item_desc])
	{
		$ItemDesc = $getItemList[item_desc];
	}
	else
	{
		$ItemDesc = "<i>no decription available for this Item :(";
	}

	$ItemList .= "<tr><td><p align=center><img src=images/user_images/opg_$game/items/item_$getItemList[id].gif border=1><br><b>$getItemList[item_name]</b></p></td><tr>
<tr><td><p><font size=-1><b>Description:</b> $ItemDesc<br><b>Est. Value:</b> $getItemList[item_value]</font></p></td></tr>";
}

ECHO <<<END

<HTML>
<HEAD>
<TITLE>$gameName2: $page_title</TITLE>
<script language="JavaScript">

function closeWindow(url)
{
   	window.close();
}

</script>

	<style><!--
	A:link {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:visited {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:hover {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	A:active {
	text-decoration:  underline;
	color: $mainlinkColor;
	}
	--></style>

</HEAD>
<BODY BGCOLOR="$reallyLight">

<p align=center>Showing you <b>$numItems2</b> of <b>$numItems</b> items.</p>

<center>
<table width=225>
<tr><td><p align=center><b><font size=+2>-- List Items -- </b></font></td></tr>

$ItemList

</table>
</center>

END;

if (($numItems > $max) AND ($start < ($numItems - $max)))
{
	echo "<p align=center><a href=$base_url/listitems.php?game=$game&start=$max2>Next page</a></p>";
}
if ($start != 0)
{
	$prev_min = $start - $max;
	echo "<p align=center><a href=$base_url/listitems.php?game=$game&start=$prev_min>Previous page</a></p>";
}

print "<p align=center><input type=button name=closeWin value=\"Close Window\" onClick=\"javascript:closeWindow('');\"></p>";

?>